type _typeObj = { [anyKey: string]: any };

export const copy = (_object: _typeObj, _obj: _typeObj = {}): _typeObj => {
  if (!(Object.prototype === Object.getPrototypeOf(_object))) {
    return new Error('传入参数***_object***类型错误');
  }
  for (const key in _object) {
    if (Object.prototype === Object.getPrototypeOf(_object[key])) {
      _obj[key] = copy(_object[key]);
    } else {
      _obj[key] = _object[key];
    }
  }
  return JSON.parse(JSON.stringify(_object));
  // return _obj;
};
export default { copy };
